
#include"vector.h"
//
//template<class T , typename Y>
//void swap(T a , Y b)
//{
//	int tmp = a;
//	a = b;
//	b = tmp;
//}

void test1()
{

	/*vector<int> v{ 3,2,6,8,9,6,4,7 };
	v.erase(v.end() - 1);
	vector<int>::iterator it = v.begin();
	v.erase(it);
	cout << *it <<endl;
	for (auto& au : v)
	{
		cout << au << " ";
	}*/
	/*string st("linhui");
	string st1(st);
	printf("%p\n", &st);
	printf("%p\n", &st1);*/


	//string st("linhui");
	////vector<string> v(4, st);
	//vector<vector<string>> v(4, {"abcdef"});
	//cout<<v[1][0];
	/*for (const auto& au : v)
	{
		cout << au << " ";
	}*/


	/*vector<char> v1;
	vector<char> v2(10, 'i');
	vector<char> v3(v2.begin(), v2.end());


	vector<char> v4{'d','c','e','s','a','p'};

	cout << *v4.begin() << endl;
	cout << *(v4.begin() + 3) << endl;
	cout << typeid(v4.begin()).name() << endl;*/
	/*cout << " v4:";
	for (const auto& au : v4)
	{
		cout << au << " ";
	}

	cout << endl;
	cout << "initial size:" << v4.size() << " " << "initial capacity:" << v4.capacity() << endl;

	cout << " v4:" ;
	v4.resize(11);
	for (const auto& au : v4)
	{
		cout << au << " ";
	}
	cout << endl;
	cout << " size:" << v4.size() << " " << " capacity:" << v4.capacity() << endl;*/


	//��֤���ݻ���  
	/*v1.reserve(50);
	cout << "initial size:" << v1.size() <<" " << "initial capacity:" << v1.capacity() << endl;
	for (size_t i = 0; i < 20; i++)
	{
		int size = v1.size(), capacity = v1.capacity();
		v1.push_back('i');
		if (capacity != v1.capacity())
			cout << "new capacity:" << v1.capacity() << endl;
	}
	v1.reserve(25);
	cout << "\ size:" << v1.size() << " " << "capacity:" << v1.capacity() << endl;
	v1.reserve(15);
	cout << "\ size:" << v1.size() << " " << "capacity:" << v1.capacity() << endl;*/


	//swap<int, double>(3, 3.23);
}

namespace linhui
{
	void test1()
	{
		vector<int> v;
		vector<int> v1(5,6);
		v1.push_back(999);
		v1.push_back(999);
		v1.push_back(999);
		v1.push_back(999);
		v1.push_back(999);
		v1.push_back(999);
		vector<int>::iterator it = v1.begin();

		while (it != v1.end())
		{
			cout << *it << " ";
			it++;
		}
		cout << endl;
		for (auto &au : v1)
		{
			cout << au << " ";
		}
		//vector<int> v2();
	}
	void test2()
	{
		vector<double> v;
		//����β��
		v.push_back(2.3);
		v.push_back(2.3);
		v.push_back(2.3);
		v.push_back(2.3);
		v.push_back(2.3);
		v.push_back(2.3);
		v.push_back(2.3);
		v.push_back(2.3);
		//���Ե��������乹��
		vector<double> vv(v.begin(), v.end());
		vector<double>::iterator it = vv.begin();
		//���Ե���������
		while (it != vv.end())
		{
			cout << *it <<" ";
			it++;
		}
		cout << endl;
		//����resize
		vv.resize(10,9.9);
		for (auto& au : vv)
		{
			cout << au << " ";
		}
		cout << endl << "size:" << vv.size() << "capacity" << vv.capacity();
	}
	void test3()
	{
		vector<int> v1;
		//˳�����һ�´�0��Ԫ�ؿ�ʼβ���push_back
		for (size_t i = 0; i < 15; i++)
		{
			v1.push_back(i);
		}
		//���Կ�������
		vector<int> v2(v1);
		for (auto& au : v2)
		{
			cout << au << " ";
		}
		cout << endl;
		//����[]����
		cout << v2[0] << endl;
		cout << v2[1] << endl;
		cout << v2[2] << endl;
		cout << v2[3] << endl;
		cout << v2[14] <<endl;
	}
	void test4()
	{
		//������ֵĸ�ֵ����(�������ڿ���������ĵ��������乹�캯��)
		vector<int> v(8, 2);
		vector<int> vv;
		vv = v;
		for (auto& au : v)
		{
			cout << au << " ";
		}
	}
	void test5()
	{
		//����print��insert
		vector<double> v(3, 7.9);
		print_container(v);
		v.insert(v.begin(), 6.66);
		v.insert(v.begin(), 6.66);
		v.insert(v.begin(), 6.66);
		v.insert(v.begin(), 6.66);
		v.insert(v.begin(), 6.66);
		v.insert(v.end(), 6.66);
		print_container(v);
	}
	void test6()
	{
		//����erase
		vector<double> v;
		v.push_back(5.1);
		v.push_back(8.2);
		v.push_back(9.8);
		v.push_back(3.7);
		v.push_back(6.0);
		v.push_back(5.3);
		print_container(v);
		v.erase(v.begin());
		print_container(v);
		cout << *v.end();

		//vector<double> v(3, 7.9);
		//vector<double> vv(v);
		//print_vector(vv);
	}

	void test7()
	{
		vector<int> v;
		v.push_back(1);
		v.push_back(1);
		v.push_back(2);
		v.push_back(3);
		v.push_back(4);
		v.push_back(5);
		v.push_back(6);
		/*v.push_back(1);
		v.push_back(2);
		v.push_back(3);
		v.push_back(4);
		v.push_back(5);*/
		print_container(v);
		//����ż��
		vector<int>::iterator it = v.begin();
		while (it != v.end())
		{
			if (*it % 2 != 0)
			{
				v.erase(it);
			}
			else
			{
				it++;
			}
		}
		print_container(v);

	}
	void test8()
	{
		/*std::list<int> li{ 3, 2, 1, 6 };
		vector<int> v(li.begin(), li.end());*/

		//vector<int> v(5, 9);

		std::string st("hello");
		vector<string> v;
		v.push_back(st);
		v.push_back(st);
		v.push_back(st);
		v.push_back(st);
		v.push_back(st);
		print_container(v);
	}
}
enum name
{
	yes = 4,
	no,
	but
}; 
int main()
{
	printf("%d %d %d", yes, no, but);
	//linhui::test8();
	//linhui::test7();
	//linhui::test6();
	//linhui::test5();

	//linhui::test4();
	//cout << huangan;
	
	//linhui::test3();
	//linhui::test2();
	// linhui::test1();
	//test1();
	/*for ( int i = 0;arcg[i] ;i++)
	{
		cout << arcg[i] << " ";
	}
	cout << endl;
	for (int j = 0; arcgb[j]; j++)
	{
		cout << arcg[j] << " ";

	}*/

	return 0;
}